#coding=utf-8
from django.db import models
from PublicTool.BaseModel import Base_UserModel


__author__ = 'czq'
class Province(models.Model):
    name=models.CharField(u"省",max_length=10)
    def __unicode__(self):
        return self.name
    class Meta:
        verbose_name = '省份'
        verbose_name_plural = '省份'

class City(models.Model):
    name=models.CharField(u"省",max_length=10)
    province=models.ForeignKey(Province,verbose_name=u"省")
    cityCode=models.IntegerField(u"城市代码",default=0)
    def __unicode__(self):
        return self.name
    class Meta:
        verbose_name = '城市'
        verbose_name_plural = '城市'


class District(models.Model):
    name=models.CharField(u"区",max_length=10)
    city=models.ForeignKey(City,verbose_name=u"城市")
    def __unicode__(self):
        return self.name
    class Meta:
        verbose_name = '区'
        verbose_name_plural = '区'



class PositionType(Base_UserModel):
    POS_TYPE_START=0
    POS_TYPE_MIDDLE=1
    POS_TYPE_END=2
    POS_TYPE_SELECT=(
        (POS_TYPE_START, '起点'),
        (POS_TYPE_MIDDLE, '行程中'),
        (POS_TYPE_END, '终点'),
    )

    name=models.CharField(u"名称",max_length=10)
    rank=models.IntegerField(u"排序",default=0)

    type=models.IntegerField(u"类型",choices=POS_TYPE_SELECT,default=0)
    #City=models.ForeignKey(City,verbose_name=u"城市")
    def __unicode__(self):
        return self.name
    class Meta:
        verbose_name = '位置类型'
        verbose_name_plural = '位置类型'
        ordering=['rank']


class LineType(Base_UserModel):
    name=models.CharField(u"名称",max_length=10)
    rank=models.IntegerField(u"排序",default=0)
    def __unicode__(self):
        return self.name
    class Meta:
        verbose_name = '线路类型'
        verbose_name_plural = '线路类型'
        ordering=['rank']

#Street  StreetNumber